const path = require("path")
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const CopyWebpackPlugin = require("copy-webpack-plugin")

module.exports = {
    mode: "none",
    entry: "./src/main.js",
    output: {
        filename: "bunder.js",
        path: path.join(__dirname, "dist"),
        // publicPath: "dist/"
    },
    module: {
        rules: [
            {
                test: /.css$/,
                // 也可以使用模块路劲
                use: [
                    "style-loader",
                    "css-loader"
                ]
               
            },
            {
                test: /.png$/,
                use: {
                    loader: "url-loader",
                    options: {
                        limit: 1024 * 10 // 10KB
                    }
                }
            }
        ] 
    },
    plugins: [
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            title: "HtmlWebpackPlugin 66666",
            meta: {
                viewport: 'width=device-width'
            },
            template: "./src/index.html"
        }),
        new HtmlWebpackPlugin({
            filename: "about.html"
        }),
        new CopyWebpackPlugin({
            patterns: [
                "public"
            ]
        })
    ]
}